<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<meta http-equiv="Content-Type" content="text/html; charset=">
<title>Detalle del aplicante</title>

<link rel="stylesheet"
	href="<%=request.getContextPath()%>/style/gen-style.css"
	type="text/css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/style/mkv/jquery-ui.css"
	type="text/css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/style/makovo-style.css"
	type="text/css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/style/jquery.steps.css"
	type="text/css" />

<script type="text/javascript"
	src="<%=request.getContextPath()%>/scripts/jquery-2.1.3.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/scripts/gen.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/scripts/spin.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/scripts/jquery-ui-1.9.2.custom.min.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/scripts/pdfobject_source.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/scripts/auxiliares.js"></script>
<script type="text/javascript">
	$(document).ready(
			function() {
				if (validaSesion("${sessionScope.LoginMenu}"))
					document.location = "index.jsp";
	
				var mCall = new Gen.AjaxCall();


				$('#Sure').dialog({
					autoOpen : false,
					modal : true,
					width : 500,
					height : 300,
					open : function(event, ui) {

					},
					close : function(event, ui) {
					},
					buttons : {
						"Continuar" : function() {
							$('#Sure').dialog('close')
							return true;
						},
						"Cancelar" : function() {
							$('#Sure').dialog('close')
							return false;
						}
					}
				});

				$('#deleteForm').click(function() {
					$('#Sure').dialog('open');
				});

				function getApplicantDetails() {
					mCall.post('ajax/GetApplicantDetails.action', {}, function(a) {
						if (a != null) {
							fillApInfo(a.applicantInfo);

							createAccordion(a.step);

							hideOverlay();
						}
					}, function(er) {
					});
				}

				function fillApInfo(info) {
					if (info == null)
						return;

					$('#curp').text(info.curp.toUpperCase());
					$('[name=curp]').val(info.curp.toUpperCase());
					$('#name').text(info.name.toUpperCase());
					$('#last-name').text(info.lastName.toUpperCase());
					$('#second-last').text(info.secondLastName.toUpperCase());
					$('#birth').text(info.birth.toUpperCase());
					$('#phone').text(info.phone.toUpperCase());
					$('#idType').text(info.typeID.toUpperCase());
					$('#civState').text(info.MState.toUpperCase());

					$('#printFormat0').show();

					$('#appAddress').append(
							"Calle: " + info.address.street.toUpperCase() + " Num ext: " + info.address.extNum.toUpperCase()
									+ " Num int: " + info.address.intNum.toUpperCase() + "<br/>Localidad: "
									+ info.address.loc.toUpperCase() + " " + info.address.city.toUpperCase() + ", "
									+ info.address.state.toUpperCase() + " <br/>CP  : " + info.address.cp.toUpperCase()
									+ "<br/>Latitud : " + info.address.lat + "<br/>Longitud : " + info.address.lonng);

					if (info.appStep == 102)
						$('#approved-info').show();
					else if (info.appStep == 103)
						$('#rejected-info').show();
				}

				function createAccordion(step) {
					for (var i = 1; i <= step; i++)
						$('[step=' + i + ']').show();

					$("#accordion").accordion({
						heightStyle : "content"
					});
				}

				showOverlay(true);
				getApplicantDetails();

			});
</script>
</head>
<body>
	<div style="width: 1100px; margin: 0 auto">
		<div class="headerMK">
			<div class="logo">
				<span class="hdTitulo">Sistema para Aplicación de Subsidio
					2015</span>
			</div>
			<div
				style="font-size: 0.26em; top: -50px; position: relative; width: 500px; float: right; text-align: right; padding-right: 10px">
				<i>${sessionScope.LoginNombre}</i><b><a
					href="/makovo/paginas/index.jsp"> - Cerrar Sesión</a></b>
			</div>
		</div>
		<div class="divContenido">
			<a href="<%=request.getContextPath()%>/paginas/menu.jsp">Regresar
				al menú</a><br />

			<h3>Eliminar Aplicante</h3>
			<div class="detail-approve-info rejected" id="rejected-info"
				style="display: none;">Aplicante rechazado</div>
			<div class="detail-approve-info approved" id="approved-info"
				style="display: none;">Aplicante aprobado</div>
			<div>
				<div id="accordion" style="width: 800px; margin: 0px auto">
					<h3 step="2" style="display: none;">Información básica</h3>
					<s:form action="deleteApplicant">
						<div step="2" style="display: none;">
							<table style="border-spacing: 1em; border-collapse: separate;">
								<tr>
									<td>CURP:</td>
									<td><span id="curp" style="color: #333333;"></span>
										<s:hidden name="curp" value="" />
									</td>
								
								</tr>
								<tr>
									<td>Nombre (s):</td>
									<td><span id="name" style="color: #333333;"></span></td>
								</tr>
								<tr>
									<td>Apellido paterno:</td>
									<td><span id="last-name" style="color: #333333;"></span></td>
								</tr>
								<tr>
									<td>Apellido materno:</td>
									<td><span id="second-last" style="color: #333333;"></span></td>
								</tr>
								<tr>
									<td>Fecha Nacimiento:</td>
									<td><span id="birth" style="color: #333333;"></span></td>
								</tr>
								<tr>
									<td>Teléfono:</td>
									<td><span id="phone" style="color: #333333;"></span></td>
								</tr>
								<tr>
									<td>Tipo de identificación:</td>
									<td><span id="idType" style="color: #333333;"></span></td>
								</tr>
								<tr>
									<td>Estado civil:</td>
									<td><span id="civState" style="color: #333333;"></span></span></td>
								</tr>
								<tr>
									<td>Domicilio aplicante:</td>
									<td><span id="appAddress" style="color: #333333;"></span></td>
								</tr>
							</table>
							<br />

						</div>
						<div style="margin:0 auto;">
							<s:submit value="Eliminar Aplicante" cssClass="t-btn medium change" />
						</div>
						

					</s:form>
				</div>

			</div>
		</div>


		<div id="Sure">
			<div style="color: rgba(180, 0, 0, .8)">
				El aplicante será eliminado. <br>Esta operación no se puede
				deshacer.
			</div>
		</div>

	</div>
</body>
</html>